#!/bin/sh
REQUIREMENTS=0
PACKAGES="mono-jit python-gtk2 mono-classlib-2.0 libglade2.0-cil librsvg2-common python-gnome2-desktop python-gnome2-extras libgtk2.0-cil"
MISSING_PKGS=""

show_zenity_dialog()
{
	zenity --warning --text "<b>Missing packages:</b>\n\
The following packages are missing in your system:\n\n\
<b>$MISSING_PKGS</b>\n\n\
You will need to install them if you want to run Tangerine.\n\
If you are in Ubuntu/Debian, open a terminal and type:\n\
<i>apt-get install $MISSING_PKGS</i>"
}

show_kdialog_dialog()
{
	kdialog --msgbox "<b>Missing packages:</b><br/>\
The following packages are missing in your system:<br/><br/>\
<b>$MISSING_PKGS</b><br/><br/>\
You will need to install them if you want to run Tangerine.<br/>\
If you are in Ubuntu/Debian, open a terminal and type:<br/>\
<i>apt-get install $MISSING_PKGS</i>"
}

if test -z `which apt-cache`; then
	echo "This is not a Debian based distribuiton, can't detect..."
	exit 0
fi
for p in $PACKAGES; do
	if test -n "`apt-cache policy $p 2>/dev/null|grep -ie 'installed.*none'`" ; then
		MISSING_PKGS+="$p "
		echo "$p not installed"
	fi
done

if test ! -z "$MISSING_PKGS"; then
	if test ! -z `which zenity`; then
		show_zenity_dialog
	elif test ! -z `which kdialog`; then
		show_kdialog_dialog
	fi
fi
exit 0
